package cn.edu.zut.hhr.controller;

import cn.edu.zut.hhr.annotation.LogAnnotation;
import cn.edu.zut.hhr.service.UpLoadService;
import cn.edu.zut.hhr.vo.RestResponse;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;
import java.io.IOException;


@RestController
@RequestMapping("/upload")
public class UpLoadController {

    @Resource
    UpLoadService upLoadService;

    @LogAnnotation(module = "上传",operator = "文件上传")
    @PostMapping("/up")
    public RestResponse upLoad(@RequestParam("img") MultipartFile img) throws IOException {
        return upLoadService.upLoad(img);
    }

}
